package com.example.servlet;

import jakarta.servlet.*;
import jakarta.servlet.annotation.WebFilter;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.io.IOException;

@WebFilter(filterName = "MyFilter", urlPatterns = "/*")
public class MyFilter implements Filter {
    final static Logger logger = LoggerFactory.getLogger(MyFilter.class);

    public void init(FilterConfig config) throws ServletException {
        logger.debug("过滤器init:{}", config);
    }

    public void destroy() {
    }

    @Override
    public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws ServletException, IOException {
        chain.doFilter(request, response);
//        logger.debug("过滤器doFilter:{},{},{}", request, response, chain);


    }
}
